<template>
    <div v-if="props.data && props.data.length" class="teacher-list-container">
        <div class="teacher-item-container"  v-for="item in props.data" :key="item.id" :data="item">
            <div class="teacher-img-wrap">
                <LazyImage :src="item.picture || ImgHead" class-name="teacher-img" />
            </div>
            <div class="teacher-info">
                <div class="teacher-name">
                    <Ellipsis :content="item.name"/>
                </div>
                <div class="teacher-school">
                    <Ellipsis :content="item.workPlace"/>
                </div>
                <div class="teacher-desc">
                    <Ellipsis
                        :content="item.description || '暂无简介'"
                        :rows="3"
                        :line-height="18"
                        effect="light"/>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import LazyImage from '@/components/lazy-image/lazy-image.vue';
import Ellipsis from '@/components/ellipsis.vue';
import ImgHead from '@/assets/img/mooc/img-head.png';

const props = defineProps({
    data: {
        type: Array,
        default: () => []
    }
});
</script>

<style lang="scss" scoped>
.teacher-list-container {
    margin: -20px -20px 0 0;
    display: flex;
    flex-wrap: wrap;
    .teacher-item-container {
        display: flex;
        width: 373px;
        height: 160px;
        background: #F7F9FA;
        padding: 14px;
        border-radius: 5px;
        font-family: MicrosoftYaHei;
        margin: 20px 20px 0 0;
        .teacher-img-wrap {
            width: 100px;
            height: 100%;
            border-radius: 4px;
            .teacher-img {
                width: 100%;
                height: 100%;
                border-radius: 4px;
            }
            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
            }
        }
        .teacher-info {
            flex: 1;
            margin: 13px 0 0 14px;
            width: 223px;
            .teacher-name {
                font-size: 16px;
                color: var(--srt-main-text-color);
                line-height: 16px;
            }
            .teacher-school {
                font-size: 14px;
                color: var(--srt-main-text-color);
                line-height: 14px;
                margin-top: 8px;
            }
            .teacher-desc {
                font-size: 12px;
                color: var(--srt-color-gray);
                line-height: 18px;
                margin-top: 14px;
            }
        }
    }
}
</style>